package org.unicom.controller.test;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;

@RestController
public class JdbcController {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @DS("lf1")
    @GetMapping("/list")
    public List<Map<String, Object>> list() {
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from t_tabs");
        return maps;
    }

    @DS("xx1")
    @GetMapping("/list2")
    public List<Map<String, Object>> list2() {
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from t_tabs");
        return maps;
    }

}
